home *** CD-ROM | disk | FTP | other *** search
/ isnet Internet / Isnet Internet CD.iso / prog / hiz / 09 / 09.exe / adynware.exe / perl / lib / site / Win32 / Client.pl < prev    next >
Encoding:
Text File  |  1999-12-28  |  1.9 KB  |  64 lines

  1.  
  2.  
  3.     use Win32::Pipe;
  4.  
  5.  
  6.  
  7.     $PipeName = "\\\\.\\pipe\\TEST this LoNG Named Pipe!";
  8.  
  9.     print "I am falling asleep for few seconds, so that we give time\nFor the server to get up and running.\n";
  10.     sleep(4);
  11.     print "\nOpening a pipe ...\n";
  12.  
  13.  
  14.  
  15.     if ($Pipe = new Win32::Pipe($PipeName)){
  16.         print "\n\nPipe has been opened, writing data to it...\n";
  17.         print "-------------------------------------------\n";
  18.         $iFlag2 = 1;
  19.         $Pipe->Write( "\n" . Win32::Pipe::Credit() . "\n\n");
  20.         while($iFlag2){
  21.             print "\nCommands:\n";
  22.             print "  FILE:xxxxx  Dumps the file xxxxx.\n";
  23.             print "  Credit      Dumps the credit screen.\n";
  24.             print "  Quit        Quits this client (server remains running).\n";
  25.             print "  Exit        Exits both client and server.\n";
  26.             print "  -----------------------------------------\n";
  27.  
  28.             $In = <STDIN>;
  29.             chop($In);
  30.  
  31.             if (($File = $In) =~ s/^file:(.*)/$1/i){
  32.                 if (-s $File){
  33.                     if (open(FILE, "< $File")){
  34.                         while ($File = <FILE>){
  35.                             $In .= $File;
  36.                         };
  37.                         close(FILE);
  38.                         undef $File;
  39.                     }
  40.                 }
  41.             }
  42.             if($In =~ /^credit$/i){
  43.                 $In = "\n" . Win32::Pipe::Credit() . "\n\n";
  44.             }
  45.  
  46.             $iFlag2 = $Pipe->Write("$In");
  47.             if($In =~ /^(exit|quit)$/i){
  48.                 print "\nATTENTION: Closing due to user request.\n";
  49.                 $iFlag2 = 0;
  50.             }
  51.  
  52.             undef $In;
  53.  
  54.         }
  55.         $Pipe->Close();
  56.     }else{
  57.         ($Error, $ErrorText) = Win32::Pipe::Error();
  58.         print "Error:$Error \"$ErrorText\"\n";
  59.         sleep(4);
  60.     }
  61.  
  62.  
  63.  
  64.